package com.s.core.root.data;

import com.c1.client.pan.PanConf;
import com.s.core.root.D;

import java.math.BigDecimal;

public class _PointAvg extends _BasePoint {
    public int avgCount;

    public _PointAvg(_BasePic pic, D d, int total, int recentIndex, int avgCount) {
        super(pic, d, total, recentIndex);
        this.avgCount = avgCount;
    }

    @Override
    public int posValue() {
        return d.getPosAvg(avgCount);
    }

    @Override
    public BigDecimal volValue() {
        return new BigDecimal(d.volNAvg(avgCount));
    }

    @Override
    protected InfoAndStyle yInfoValue() {
        return null;
    }

    @Override
    protected InfoAndStyle xInfoValue() {
        if (recentIndex == 0) {
            return new InfoAndStyle(String.valueOf(avgCount), PanConf.me().xInfoStyle);
        }
        return null;
    }

    @Override
    protected PanConf.PosStyle posStyleValue() {
        return PanConf.me().commonPosStyle;
    }

    @Override
    protected PanConf.CjlStyle cjlStyleValue() {
        return PanConf.me().cjlStyle;
    }
}
